﻿----------------------------------
--      Module Declaration      --
----------------------------------

local boss = BB["Ichoron"]
local mod = BigWigs:New(boss, tonumber(("$Revision: 543 $"):sub(12, -3)))
if not mod then return end
mod.partyContent = true
mod.otherMenu = "Dalaran"
mod.zonename = BZ["The Violet Hold"]
mod.enabletrigger = boss 
mod.guid = 29313
mod.toggleoptions = {"bubble", "frenzy", "bosskill"}

----------------------------------
--         Localization         --
----------------------------------

local L = AceLibrary("AceLocale-2.2"):new("BigWigs"..boss)

L:RegisterTranslations("enUS", function() return {
	bubble = "Protective Bubble",
	bubble_desc = "Announce when Icharon loses the Protective Bubble",
	bubbleEnded_message = "Protective Bubble Faded",
	bubble_message = "Gained Protective Bubble",
	cmd = "Ichoron",
	frenzy = "Frenzy",
	frenzy_desc = "Warn when Ichoron becomes Frenzied.",
}

end )

L:RegisterTranslations("deDE", function() return {
	bubble = "Schützende Blase",
	bubble_desc = "Ankündigen wenn Icharon seine Schützende Blase verliert.",
	bubbleEnded_message = "Schützende Blase verschwunden!",
	bubble_message = "Schützende Blase erhalten!",
	cmd = "Ichoron",
	frenzy = "Raserei",
	frenzy_desc = "Warnung wenn Ichoron in Raserei verfällt.",
}

end )

L:RegisterTranslations("esES", function() return {
}

end )

L:RegisterTranslations("esMX", function() return {
}

end )

L:RegisterTranslations("frFR", function() return {
	bubble = "Bulle protectrice",
	bubble_desc = "Prévient quand Icharon perd sa Bulle protectrice.",
	bubbleEnded_message = "Bulle protectrice disparue",
	bubble_message = "Bulle protectrice en place",
	cmd = "Ichoron",
	frenzy = "Frénésie",
	frenzy_desc = "Prévient quand Ichoron entre en frénésie.",
}

end )

L:RegisterTranslations("koKR", function() return {
	bubble = "거품 보호막",
	bubble_desc = "이코론의 거품 보호막 유/무를 알립니다.",
	bubbleEnded_message = "거품 보호막 사라짐",
	bubble_message = "거품 보호막 획득",
	cmd = "이코론",
	frenzy = "광기",
	frenzy_desc = "이코론의 광기에 대하여 알립니다.",
}

end )

L:RegisterTranslations("ruRU", function() return {
	bubble = "Защитный пузырь",
	bubble_desc = "Предупреждать о потере Защитного пузыря",
	bubbleEnded_message = "Защитный пузырь исчерпан",
	bubble_message = "Наложен Защитный пузырь",
	cmd = "Гнойрон",
	frenzy = "Бешенство",
	frenzy_desc = "Предупреждать, когда Гнойрон впадает в Бешенство.",
}

end )

L:RegisterTranslations("zhCN", function() return {
	bubble = "保护气泡",
	bubble_desc = "当艾库隆失去保护气泡时发出警报。",
	bubbleEnded_message = "保护气泡 消失！",
	bubble_message = "获得 保护气泡！",
	frenzy = "狂乱",
	frenzy_desc = "当艾库隆狂乱时发出警报。",
}

end )

L:RegisterTranslations("zhTW", function() return {
	bubble = "保護泡泡",
	bubble_desc = "當伊仇隆失去保護泡泡時發出警報。",
	bubbleEnded_message = "保護泡泡 消失！",
	bubble_message = "獲得 保護泡泡！",
	cmd = "伊仇隆",
	frenzy = "狂亂",
	frenzy_desc = "當伊仇隆狂亂時發出警報。",
}

end )

----------------------------------
--        Initialization        --
----------------------------------

function mod:OnEnable()
	self:AddCombatListener("SPELL_AURA_APPLIED", "Bubble", 54306)
	self:AddCombatListener("SPELL_AURA_REMOVED", "BubbleRemoved", 54306)
	self:AddCombatListener("SPELL_AURA_APPLIED", "Frenzy", 54312, 59522)
	self:AddCombatListener("UNIT_DIED", "BossDeath")
end

----------------------------------
--        Event Handlers        --
----------------------------------

function mod:Bubble(_, spellId)
	if self.db.profile.bubble then
		self:IfMessage(L["bubble_message"], "Important", spellId)
	end
end

function mod:BubbleRemoved(_, spellId)
	if self.db.profile.bubble then
		self:IfMessage(L["bubbleEnded_message"], "Positive", spellId)
	end
end

function mod:Frenzy(_, spellId, _, _, spellName)
	if self.db.profile.frenzy then
		self:IfMessage(spellName, "Important", spellId)
	end
end
